//保存
function save() {

    //参数名称
    if($("#paramName").val() == "") {
        $("#paramName").tips({
            side: 3,
            msg: '输入参数名称',
            bg: '#AE81FF',
            time: 2
        });
        $("#paramName").focus();
        return false;
    }else{
        $("#paramName").val($.trim($("#paramName").val()));
    }

    //参数值
    if($("#paramValue").val() == "") {
        $("#paramValue").tips({
            side: 3,
            msg: '输入参数值',
            bg: '#AE81FF',
            time: 2
        });
        $("#paramValue").focus();
        return false;
    }else{
        $("#paramValue").val($.trim($("#paramValue").val()));
    }

    //参数描述
    if($("#paramDesc").val() == "") {
        $("#paramDesc").tips({
            side: 3,
            msg: '输入参数描述',
            bg: '#AE81FF',
            time: 2
        });
        $("#paramDesc").focus();
        return false;
    }else{
        $("#paramDesc").val($.trim($("#paramDesc").val()));
    }

    $("#form").submit();
    $("#zhongxin").hide();
    $("#zhongxin2").show();
}

$(function() {
    //下拉框
    if(!ace.vars['touch']) {
        $('.chosen-select').chosen({allow_single_deselect:true});
        $(window)
            .off('resize.chosen')
            .on('resize.chosen', function() {
                $('.chosen-select').each(function() {
                    var $this = $(this);
                    $this.next().css({'width': $this.parent().width()});
                });
            }).trigger('resize.chosen');
        $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
            if(event_name != 'sidebar_collapsed') return;
            $('.chosen-select').each(function() {
                var $this = $(this);
                $this.next().css({'width': $this.parent().width()});
            });
        });
        $('#chosen-multiple-style .btn').on('click', function(e){
            var target = $(this).find('input[type=radio]');
            var which = parseInt(target.val());
            if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
            else $('#form-field-select-4').removeClass('tag-input-style');
        });
    }
});
